// 电影详情
var express = require('express');
var router = express.Router();
const sql = require('../conf/sql')
const pool = require('../conf/db')
// let cookieParser = reqire('cookie-parser')
var session  =require('express-session')
//电影详情
router.get('/movieinfo', function (req, res, next) {
  // console.log(req.query.mname);
  pool.query(sql.queryMovieInfo, [req.query.mname], (err, result) => {
    if (err) {
      console.log(err);
      next(err)
      return;
    }
    // console.log(result[0].mname);
    if (result.length == 0) {
      res.json({ code: 201, msg: '请求失败' });
      return;
    } else {

      res.json({ code: 200, msg: '请求成功', data: result});

    }
  })
  
});



module.exports = router